package com.big.common.utils;

import java.util.*;


public class StringReplace {

    /**
     * 简介高亮
     */
//<font color='#ff6700'></font>
    public static String Introduction(String intro,String search){
        String Introduction="_"+intro+"_";
        String StringIntroduction="";
        System.out.println("原始字符串是'"+intro+"'");
        String pattern = "(?i)"+search+"";
        System.out.println(pattern);
        StringIntroduction = intro.replaceAll(pattern, ""+search.toUpperCase()+"");
        System.out.println(StringIntroduction);
        return StringIntroduction;
    }


    /**
     * 判断是否英文
     *
     */
    public boolean Ymatches(String str){
        return str.matches("[a-zA-Z]+");
    }

    /**
     * 名称高亮
     */
    public static String Nametion(String name,String search){
        String StringIntroduction="";
        String pattern = "(?i)"+search+"";
        System.out.println(pattern.split(search));
        StringIntroduction = name.replaceAll(pattern, "<font color='#ff6700'>"+search.toUpperCase()+"</font>");
        System.out.println(StringIntroduction);
        return StringIntroduction;
    }


    /**
     * 是否是大写
     */
    public static boolean isUpperCase(char c) {
        return c >=65 && c <= 90;
    }


    /**
     * 是否是小写
     */
    public static boolean isLowerCase(char c) {
        return c >=97 && c <= 122;
    }


    public static void main(String[] args) {

        System.out.println(Introduction("外星人Alienware51mr2","a"));

    }


}
